package com.usian.controller;

import com.usian.pojo.User;
import com.usian.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("/findById/{id}")
    public User findById(@PathVariable Integer id){
        return userService.findById(id);
    }


    /**
     * 通过问号的方式传参
     */
    @RequestMapping("/findByName")
    public User findByName(@RequestParam String name){
        return userService.findByName(name);
    }

    @RequestMapping("/findByUser")
    public User findByUser(@RequestBody User user){
        return userService.findByUser(user);
    }

}
